package com.lagou.edu.servce.impl;

import com.lagou.edu.dao.TokenDao;
import com.lagou.edu.pojo.LagouToken;
import com.lagou.edu.servce.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author 梅松
 * @Date 2021/10/23 0:40
 */
@Service
public class TokenServiceImpl implements TokenService {
    @Autowired
    private TokenDao tokenDao;

    @Override
    @Transactional
    public boolean save(LagouToken lagouToken){
        try {
            tokenDao.save(lagouToken);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

    @Override
    public LagouToken findByToken(String token){
        return tokenDao.findLagouTokenByToken(token);
    }
}
